home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / cstdio.arc / SRC.ARC / MSFTF.A < prev    next >
Text File  |  1985-05-17  |  1KB  |  62 lines

  1. ;    msftf.a - file time functions.
  2. ;    (C) Copyright 1984, 1985 Gregory R. Mansfield - All Rights Reserved
  3. ;    G. R. Mansfield.  84/10/28.
  4. ;    Ver 1.0-5517.
  5.  
  6.  
  7.     include    "include/msdos.ah"
  8.  
  9.     cseg
  10.     public    mspft_
  11.     public    mssft_
  12.  
  13.  
  14. ;    long mspft()    /* pack file time */
  15.  
  16. mspft_:
  17.     mov    ah,FR_GDT    ; get date
  18.     int    I_FCN
  19.     sub    cx,1980
  20.     mov    ch,cl        ; year to 9 - 15
  21.     shl    ch,1
  22.     mov    bl,dh        ; month to 5 - 8
  23.     mov    bh,0
  24.     mov    cl,5
  25.     shl    bx,cl
  26.     or    bh,ch        
  27.     or    bl,dl        ; day to 0 - 4
  28.     push    bx
  29.     mov    ah,FR_GTM    ; get time
  30.     int    I_FCN
  31.     mov    al,cl        ; minute to 5 - 10
  32.     cbw
  33.     mov    cl,5
  34.     shl    ax,cl
  35.     shl    ch,1        ; hour to 11 - 15
  36.     shl    ch,1
  37.     shl    ch,1
  38.     or    ah,ch
  39.     shr    dh,1        ; second / 2 to 0 - 4 
  40.     or    al,dh
  41.     pop    dx
  42.     ret
  43.  
  44.  
  45. ;    long mssft(fd, tm)    /* set file time */
  46. ;    int fd;
  47. ;    long tm;
  48.  
  49. mssft_:
  50.     mov    bx,sp        ; time and date
  51.     mov    cx,[bx+4]
  52.     mov    dx,[bx+6]
  53.     mov    bx,[bx+2]    ; file handle
  54.     mov    al,1        ; set date and time
  55.     mov    ah,FR_FDT    ; file date/time
  56.     xor    si,si
  57.     int    I_FCN
  58.     jnc    sft1        ; no error
  59.     dec    si
  60. sft1:    mov    ax,si
  61.     ret
  62.